#include "Jobs.h"

Job::Job() {
    args = NULL;
}

/*

                    REPLYSYSINFO, , , NEWMODIFIED, DELETEFILE
*/

// [*] need to include new types
Job::~Job() {
    switch (type) {
        case EXITLISTENER:
        case EXITWORKER:
            break;
        case REPLYSTATUS:
            close( ((QueryStatusArgs *)args)->clntSocket );
            delete (QueryStatusArgs *)args;
            break;
        case REPLYTRANSFERFILES:
            close( ((ReplyTransferFilesArgs *)args)->clntSocket );
            delete (ReplyTransferFilesArgs *)args;
            break;
        case QUERYSTATUS:
            close( ((QueryStatusArgs *)args)->clntSocket );
            delete (QueryStatusArgs *)args;
            break;
        case NAK:
            close( ((NakArgs *)args)->clntSocket );
            delete (NakArgs *)args;
            break;
        case REPLYVFS:
            close( ((ReplyVFSArgs *)args)->clntSocket );
            delete (ReplyVFSArgs *)args;
            break;
        case TRANSFERFILE:
            close( ((TransferFileArgs *)args)->clntSocket );
            delete (TransferFileArgs *)args;
            break;
        case NEWMODIFIED:
            delete (NewModifiedArgs *)args;
            break;
        case DELETEFILE:
            delete (DeleteFileArgs *)args;
            break;
        default:
            printf("invalid Job type...wtf!!!\n");
            break;
    }
}

